package enumdemo;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class Test {
    public static void main(String[] args){
        Class<?> c;
        try {
            c = Class.forName("enumdemo.TestEnum");

            Constructor<?> constructor =
                    c.getDeclaredConstructor(String.class,int.class,int.class,String.class);
            constructor.setAccessible(true);

            TestEnum testEnum = (TestEnum)constructor.newInstance("fsdfafa",99,4,"棕色");

            System.out.println(testEnum);

        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        } catch (NoSuchMethodException e) {
            throw new RuntimeException(e);
        } catch (InstantiationException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        }
    }
}
